

MAXI = 101
dp = [[-1] * MAXI for _ in range(MAXI)]
dp[1][1] = 0

def sg(a, b):
	if a == 1 and b == 1:
		return 0
	if dp[a][b] != -1:
		return dp[a][b]
	appeared = [False] * (max(a, b) + 1)
	if a > 1:
		for i in range(1, a):
			appeared[ sg(i, a-i) ] = True
	if b > 1:
		for i in range(1, b):
			appeared[ sg(i, b-i) ] = True
	for s in range(max(a, b) + 1):
		if not appeared[s]:
			dp[a][b] = s
			break
	return dp[a][b]

print(' \t1 2 3 4 5 6 7 8 9\n')
for a in range(1, 10):
	print(f'{a}\t', end='')
	for b in range(1, 10):
		print(sg(a,b), end=' ')
	print()